package com.accp.ssmoa.service.impl;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.accp.ssmoa.dao.MenuMapper;
import com.accp.ssmoa.dao.UserMapper;
import com.accp.ssmoa.pojo.Menu;
import com.accp.ssmoa.pojo.MenuTree;
import com.accp.ssmoa.pojo.User;
import com.accp.ssmoa.service.ShiroService;



@Service("shiroService")
public class ShiroServiceImpl implements ShiroService {
	
	@Resource
	private UserMapper userDao;
	
	
	@Resource
	private MenuMapper menuDao;	

	
	public User getUserByUserName(String username) {
		return userDao.selectByUserName(username);
	}



	public User getUserById(Integer id) {
		return userDao.selectByPrimaryKey(id);
	}


	public List<Menu> getAllMenus() {
		
		//整理菜单
		List<Menu> menus=menuDao.selectAllMenus();
		
		//树形菜单封装类
		MenuTree menuTree=new MenuTree();
		
		menus=menuTree.MenuList(menus);
		
		return menus;
	}


	

}
